package edu.hitsz.aircraft;

import edu.hitsz.aircraft.shoot.SkewShoot;
import edu.hitsz.application.ImageManager;
import edu.hitsz.application.Main;
import edu.hitsz.application.MusicThread;

import java.lang.reflect.Field;

/**
 * @author CsCN
 */
public class BossEnemyFactory implements EnemyFactory {
    private static final double baseHp = 300;
    public static boolean bossExists = false;

    @Override
    public AbstractEnemy createEnemy(double rate, double elitePossibility, int shootNum) {
        if (bossExists) {
            return null;
        }
        BossEnemy boss;
        boss = new BossEnemy(
                Main.WINDOW_WIDTH / 2,
                ImageManager.BOSS_ENEMY_IMAGE.getHeight() + 1,
                10,
                0,
                (int) (baseHp * rate)
        );
        boss.setShootStrategy(new SkewShoot());
        if (Main.musicFlag) {
            Main.bgmThread.terminate();
            Main.bgmThread = new MusicThread("bgm_boss.wav", true);
            Main.bgmThread.start();
        }
        bossExists = true;
        return boss;
    }
}
